package 基础语法.网络编程;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddress_learn {

    public static void main(String[] args) throws UnknownHostException {
        InetAddress inetAddress = InetAddress.getByName("ASUS");
        System.out.println(inetAddress);
        String name = inetAddress.getHostName();
        System.out.println(name);// 主机名
        String ip = inetAddress.getHostAddress();
        System.out.println(ip);// IP

    }
}
